home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / video / zapem-0.000 / zapem-0 / zapem / gamelib.S < prev    next >
Text File  |  1995-02-22  |  1KB  |  97 lines

  1. #include "screendefs.h"
  2.  
  3. .text
  4. .align 4
  5. .globl _screencopy
  6. _screencopy:
  7.     pushl %ebp        !Standard entry
  8.     movl %esp,%ebp    
  9.  
  10.     pushl %ecx        !Save regs used
  11.     pushl %esi
  12.     pushl %edi
  13.  
  14.     movl $SCREENLENGTHL,%ecx    !A screen is 16000 dwords long
  15.     movl 8(%ebp),%esi
  16.     movl 12(%ebp),%edi
  17.     rep
  18.     movsl
  19.  
  20.     popl %edi        !Restore regs used
  21.     popl %esi
  22.     popl %ecx
  23.  
  24.     movl %ebp,%esp        !Standard exit
  25.     popl %ebp
  26.     ret
  27.  
  28. .align 4
  29. .globl _showwindow
  30. _showwindow:
  31.     pushl %ebp        !Standard entry
  32.     movl %esp,%ebp    
  33.     
  34.     pushl %esi
  35.     pushl %edi    
  36.  
  37.     pushl %eax
  38.     pushl %ebx
  39.     pushl %ecx
  40.     pushl %edx
  41.  
  42.     movl 8(%ebp),%esi    !Source
  43.     movl 12(%ebp),%edi    !Destination
  44.     movl 16(%ebp),%eax    !Image width
  45.     movl $SCREENHEIGHT,%ebx    !Line counter
  46.     subl $SCREENWIDTH,%eax    !Calulate adjustment
  47.  
  48. copyline:
  49.     movl $20,%ecx    !A line is 80 dwords long
  50.  
  51. linestart:
  52.     movsl
  53.     movsl
  54.     movsl
  55.     movsl
  56.     loop linestart
  57.  
  58.     movl %esi,%edx        !Do adjustment
  59.     addl %eax,%edx
  60.     movl %edx,%esi
  61.  
  62.     decl %ebx
  63.     jne copyline
  64.  
  65.     popl %edx
  66.     popl %ecx
  67.     popl %ebx
  68.     popl %eax
  69.  
  70.     popl %edi        !Restore regs used
  71.     popl %esi
  72.  
  73.     movl %ebp,%esp        !Standard exit
  74.     popl %ebp
  75.     ret
  76.  
  77. .align 4
  78. .globl _waitvbl
  79. _waitvbl:
  80.     pushl %edx
  81.     pushl %eax    
  82.     pushl %ebx
  83.     movl $0x3da,%edx
  84.     movl $8,%ebx
  85. waitforstart:        /* wait for flag to show not in a vbl */
  86.     inw %dx,%ax
  87.     andw %bx,%ax
  88.     je waitforstart
  89. read3da:        /* Then wait until vbl starts */
  90.     inw %dx,%ax
  91.     andw %bx,%ax
  92.     jne read3da
  93.     popl %ebx
  94.     popl %eax
  95.     popl %edx
  96.     ret
  97.